Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with array checking when no array present. #334

Merged
merged 1 commit into from
Mar 20, 2015
Merged

Fix issue with array checking when no array present. #334

merged 1 commit into from
Mar 20, 2015

Conversation

jonathanio
Copy link
Contributor

The introduction of issync? in the sensu_check type for the handlers and dependencies properties introduced an assumption that the values sourced are always arrays, yet :array_matching is set.

In the event that an empty array is passed to the property within Puppet, Puppet will match this against an non-existing (nil) value and so will not write out the key/value pair on flush. When re-reading the file to analyze for changes, a nil value is loaded in return, but a NilClass has no sort method and so compilation of the catalog fails.

This change sets the defaults within the type's JSON provider to always return an empty array unless something else is configured, preventing the issync? method from raising an exception on NilClasses.

The introduction of issync? in the sensu_check type for the handlers and
dependencies properties introduced an assumption that the values sourced
are always arrays, yet :array_matching is set.

In the event that an empty array is passed to the property within
Puppet, Puppet will match this against an non-existing (nil) value and
so will not write out the key/value pair on flush. When re-reading the
file to analyze for changes, a nil value is loaded in return, but a
NilClass has no sort method and so compilation of the catalog fails.

This change sets the defaults within the type's JSON provider to always
return an empty array unless something else is configured, preventing
the issync? method from raising an exception on NilClass's.
@jlambert121
Copy link
Contributor

Thanks!

jlambert121 added a commit that referenced this pull request Mar 20, 2015
Fix issue with array checking when no array present.
@jlambert121 jlambert121 merged commit 66cbd59 into sensu:master Mar 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants